home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 1 of 3 / CHAPTE26 / EX4.C < prev    next >
C/C++ Source or Header  |  1995-07-06  |  1KB  |  30 lines

  1. // ***********************************************************************
  2. // *                                                                     *
  3. // *  Simple DLL. No initialization or detach logic is necessary, so no  *
  4. // * DllEntryPoint() is required.                                        *
  5. // *                                                                     *
  6. // ***********************************************************************
  7.  
  8. #include <windows.h>
  9.  
  10. BOOL WINAPI DllEntryPoint( HANDLE hDll, DWORD dwReason, LPVOID lpvReserved )
  11. {
  12.    if ( dwReason == DLL_THREAD_ATTACH )
  13.       MessageBox( NULL, "Thread Attaching DLL...", "Simple DLL Message", MB_OK );
  14.    if ( dwReason == DLL_THREAD_DETACH )
  15.       MessageBox( NULL, "Thread Detaching DLL...", "Simple DLL Message", MB_OK );
  16.    if ( dwReason == DLL_PROCESS_ATTACH )
  17.       MessageBox( NULL, "Process Attaching DLL...", "Simple DLL Message", MB_OK );
  18.    if ( dwReason == DLL_PROCESS_DETACH )
  19.       MessageBox( NULL, "Process Detaching DLL...", "Simple DLL Message", MB_OK );
  20. }
  21.  
  22. DWORD WINAPI SetTheErrorCondition( DWORD dwNewError )
  23. {
  24.    //  SetLastError() is called as the API function exits to set the
  25.    // value of the thread's error condition.
  26.    if ( dwNewError == 0 )
  27.       SetLastErrorEx( dwNewError, SLE_WARNING );
  28.    else
  29.       SetLastError( dwNewError );
  30. }